<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>编辑问卷</title>
		<%@ include file="/include/resources.jsp" %>
	</head>
	<body>
		<script type="text/javascript" src="msi/questionnaire/naire.js"></script>
		<script type="text/javascript" src="msi/questionnaire/questionnaire.js"></script>
		<input type="hidden" id="_chkCustId" value="<s:property value='naire.chkCustId'/>">
		<div style="padding:5px;background:#fafafa;border-bottom:1px solid #eee;">
			<table cellpadding="0" cellspacing="0" style="width:100%">
				<tr>
					<td style="text-align:left">
						<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-add" onclick="submitNaire();">保存</a>
					</td>
					<td style="text-align:right">
						<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-cancel" onclick="javascript:$('#naireDialog').dialog('close')">关闭</a>
					</td>
				</tr>
			</table>
		</div>
		<form action="" method="post" id="naireForm">
		<div style="padding:10px;height: auto;">
				<!-- 显示问卷模板 -->
				<input type="hidden" name="naire.naireId" id="naire_naireId" value="<s:property value="naire.naireId"/>">
				<input type="hidden" name="naire.projectId" id="naire_projectId" value="<s:property value="naire.projectId"/>">
				<input type="hidden" name="naire.chkCustId" value="<s:property value='naire.chkCustId'/>">
				<table cellpadding="0" cellspacing="3" >
					<s:if test="naire.naireId!=null">
						<th>机构名称：</th>
						<td>
							<s:property value="naire.chkOrgName"/>
						</td>
						<th>调查时间：</th>
						<td>
							<s:date name="naire.semTime" format="yyyy-MM-dd hh:mm:ss"/>
						</td>
					</s:if>
					<s:else>
					<tr>
						<th>机构名称：</th>
						<td>
							<input type="text" name="naire.chkOrgId" id="chkcustid" value='<s:property value="naire.chkOrgId"/>' style="width: 280px;"/>
						</td>
						<th>调查时间：</th>
						<td>
							<input type="text" id="semTime" name="naire.semTime" editable="false" class="easyui-datetimebox" value='<s:property value="naire.semTime"/>' style="width: 180px;"/>
						</td>
					</tr>
					</s:else>
				</table>
		</div>
		<div style="padding:10px;overflow-y:auto;height: 450px;scrollbar-face-color:#ffffff" id="loadNaireTemplate">
			
		</div>
		</form>
		<script type="text/javascript">
			$(function() {
				var custId = $("#_chkCustId").val();
				$('#chkcustid').chkorgselect({
					url:'selectChkOrg.do?chkOrg.custId='+custId,
					onChange:function(newValue, oldValue) {
						loadNaireTemplate(newValue);
					}
				});
				$('#chkcustid').combogrid('setText','${naire.chkOrgName}');
				var id = $("#naire_naireId").val();
				if(id != '') {
					loadNaireTemplate();
				}
			});
		</script>
	</body>
</html>